Skip to content

feat(cli): auto-detect project root by walking up for Cargo.toml#174

Merged
rocketman-code merged 4 commits intomainfrom
feat/auto-detect-project-root
Feb 28, 2026
Merged

feat(cli): auto-detect project root by walking up for Cargo.toml#174
rocketman-code merged 4 commits intomainfrom
feat/auto-detect-project-root

Conversation

@rocketman-code
Copy link
Owner

Summary

  • Add find_project_root() that walks up from CWD looking for Cargo.toml, matching cargo's project discovery behavior
  • Change --project flag on build and profile from defaulting to . to auto-detecting via find_project_root() (explicit --project still overrides)
  • Update default_runs_dir(), default_tags_dir(), and find_latest_binary() to resolve paths relative to the discovered project root instead of CWD

All piano commands (build, run, profile, report, diff, tag) now work from any subdirectory within a Rust project.

Closes #135
Closes #85

Test plan

  • 4 unit tests for find_project_root (project dir, subdirectory, nested subdirectory, error case)
  • Integration test: piano build from src/ subdirectory without --project
  • Integration test: piano report from src/ subdirectory without PIANO_RUNS_DIR
  • Integration test: piano run from src/ subdirectory
  • Existing test suite passes (all commands that pass --project explicitly still work)

@rocketman-code rocketman-code force-pushed the feat/auto-detect-project-root branch from 84f5a82 to eabb365 Compare February 28, 2026 02:32
@rocketman-code rocketman-code merged commit 155711b into main Feb 28, 2026
5 checks passed
@rocketman-code rocketman-code deleted the feat/auto-detect-project-root branch February 28, 2026 02:34
@rocketman-code rocketman-code added this to the 0.8.0 milestone Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): auto-detect project root by walking up for Cargo.toml piano report only finds project-local data when run from project root

1 participant